#include "NodeSettingsReaderWriter.h"
#include <QtGlobal>


NodeSettingsReader::NodeSettingsReader(const osg::Node& node) : m_Node(node), m_NextIndex(0)
{
}


unsigned NodeSettingsReader::getNumberOfValues() const
{
	return m_Node.getDescriptions().size();
}


QVariant NodeSettingsReader::getNextValue() const
{
	Q_ASSERT(m_NextIndex < m_Node.getDescriptions().size());
	return QVariant( QString::fromStdString(m_Node.getDescription(m_NextIndex++)) );
}


NodeSettingsWriter::NodeSettingsWriter(osg::Node *pNode) : m_rNode(pNode)
{
}


void NodeSettingsWriter::addValue(const QVariant &v)
{
	m_rNode->addDescription( v.toString().toStdString() );
}